package com.ruoyi.personnel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.personnel.domain.Mechanic;
import com.ruoyi.personnel.mapper.MechanicMapper;
import com.ruoyi.personnel.service.IMechanicService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 技工信息Service业务层处理
 *
 * @author ruoyi
 * @date 2021-02-25
 */
@Service
public class MechanicServiceImpl extends ServiceImpl<MechanicMapper, Mechanic> implements IMechanicService {

    @Override
    public List<Mechanic> queryList(Mechanic mechanic) {
        LambdaQueryWrapper<Mechanic> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(mechanic.getName())){
            lqw.like(Mechanic::getName ,mechanic.getName());
        }
        if (StringUtils.isNotBlank(mechanic.getJobNumber())){
            lqw.eq(Mechanic::getJobNumber ,mechanic.getJobNumber());
        }
        if (StringUtils.isNotBlank(mechanic.getPersonnelId())){
            lqw.eq(Mechanic::getPersonnelId ,mechanic.getPersonnelId());
        }
        if (StringUtils.isNotBlank(mechanic.getPostLevel())){
            lqw.eq(Mechanic::getPostLevel ,mechanic.getPostLevel());
        }
        if (StringUtils.isNotBlank(mechanic.getAppointmentTime())){
            lqw.eq(Mechanic::getAppointmentTime ,mechanic.getAppointmentTime());
        }
        if (StringUtils.isNotBlank(mechanic.getPostNo())){
            lqw.eq(Mechanic::getPostNo ,mechanic.getPostNo());
        }
        if (StringUtils.isNotBlank(mechanic.getStatus())){
            lqw.eq(Mechanic::getStatus ,mechanic.getStatus());
        }
        return this.list(lqw);
    }
}
